GDIR=../../..

CC=gcc
CXX=g++
EXTRADEFS=-DLINUX_OS
MACIPATH=$(GDIR)/MaCI
UTILSPATH=$(GDIR)/utils
INCLUDES=-I$(UTILSPATH) -I$(MACIPATH) -I../ASRoboBus
CFLAGS=-O0 -g3 -Wall $(INCLUDES) $(CE) \
	$(EXTRADEFS)
CPPFLAGS=-O0 -g3 -Wall $(INCLUDES) -Weffc++ $(EXTRADEFS)
LD=g++
LDFLAGS=
LIBS=-lrt -lpthread

# Sources 'base' (required external links)
SRCSC=$(UTILSPATH)/owndebug.c $(UTILSPATH)/ownutils.c
SRCSCPP=../ASRoboBus/ASRoboBus.cpp \
	serialstd.cpp \
	SerialTest.cpp
VPATH=

# Construct final lists of CPP and C objects
OBJSC=$(SRCSC:.c=.o)
OBJSCPP=$(SRCSCPP:.cpp=.opp)

# Define COMPILE and LINK commands
COMPILEC=$(CC) $(CFLAGS) -c
COMPILECPP=$(CXX) $(CPPFLAGS) -c
LINK=$(LD) $(LDFLAGS) $(LIBS)

.PHONY: all clean

all:	SerialSTD

# Rules
SerialSTD:	$(OBJSC) $(OBJSCPP)
	$(LINK) -o $@ $(OBJSC) $(OBJSCPP)

clean:
	rm -f $(OBJSC) $(OBJSCPP) SerialSTD

# Compile rule for all .o (.c) file
%.o:	%.c
	$(COMPILEC) -o $@ $<

# Compile rule for all .opp (.cpp) files
%.opp:	%.cpp
	$(COMPILECPP) -o $@ $<


